import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { cameraDefenseTaskUserVO, cameraDefenseTaskUserForm, cameraDefenseTaskUserQuery } from '@/api/camera/camera-defense-task-user/types';

/**
 * 查询布防任务-人员列表
 * @param query
 * @returns {*}
 */

export const listcameraDefenseTaskUser = (query?: cameraDefenseTaskUserQuery): AxiosPromise<cameraDefenseTaskUserVO[]> => {
  return request({
    url: '/camera/camera-defense-task-user/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询布防任务-人员详细
 * @param cameraDefenseTaskUserId
 */
export const getcameraDefenseTaskUser = (cameraDefenseTaskUserId: string | number): AxiosPromise<cameraDefenseTaskUserVO> => {
  return request({
    url: '/camera/camera-defense-task-user/' + cameraDefenseTaskUserId,
    method: 'get'
  });
};

/**
 * 新增布防任务-人员
 * @param data
 */
export const addcameraDefenseTaskUser = (data: cameraDefenseTaskUserForm) => {
  return request({
    url: '/camera/camera-defense-task-user',
    method: 'post',
    data: data
  });
};

/**
 * 修改布防任务-人员
 * @param data
 */
export const updatecameraDefenseTaskUser = (data: cameraDefenseTaskUserForm) => {
  return request({
    url: '/camera/camera-defense-task-user',
    method: 'put',
    data: data
  });
};

/**
 * 删除布防任务-人员
 * @param cameraDefenseTaskUserId
 */
export const delcameraDefenseTaskUser = (cameraDefenseTaskUserId: string | number | Array<string | number>) => {
  return request({
    url: '/camera/camera-defense-task-user/' + cameraDefenseTaskUserId,
    method: 'delete'
  });
};
